class Socket {
	public:
		virtual ~Socket() {} 
		/** 返回socket绑定的地址 **/
		virtual SocketAddress GetLocalAddress() const = 0;
		/** 返回socket连接的地址 **/
		virtual SocketAddress GetRemoteAddress() const = 0;
		
		virtual int Bind(const SocketAddress& addr) = 0;
		virtual int Connect(const SocketAddress& addr) = 0;
		virtual int Send(const void* pv, size_t length) = 0;
		virtual int SendTo(const SocketAddress& addr, const void* pv, size_t length) = 0;
		virtual int Recv(void* pv, size_t cb, int64_t* timestamp) = 0;
		virtual int RecvFrom(void* pv, size_t cb, SocketAddress* paddr, uint64_t* timestamp) = 0;

		virtual int Listen(int backlog) = 0;
		virtual Socket* Accept(SocketAddress* paddr) = 0;
		virtual int Close() = 0;
		virtual int GetError() const = 0;
		virtual int SetError(int error) = 0;
		inline bool IsBlocking() const { return IsBlockingError(GetError()); }
		enum ConnState { CS_CLOSED, CS_CONNECTING, CS_CONNECTED };
		virtual ConnState GetState() const = 0;

		enum Option {
			OPT_DONTFRAGMENT,
			OPT_RCVBUF,
			OPT_SNDBUF,
			OPT_NODELAY,
			OPT_IPV6_V6ONLY,
			OPT_DSCP,
			OPT_RTP_SENDTIME_EXTN_ID
		};
		
		virtual int GetOption(Option opt, int* value) = 0;
		virtual int SetOption(Option opt, int value) = 0;

	protected:
		Socket() {}
	private:
		// RTC_DISALLOW_COPY_AND_ASSIGN(Socket)
		// 不允许赋值操作和拷贝构造
};
	
		
